from flyweightpattern.concreteflyweight import ConcreteFlyweight


class FlyweightFactory(object):
    _flyweights = {}

    def get_flyweight(self, key):
        if not self._flyweights.get(key):
            self._flyweights[key] = ConcreteFlyweight(key)
        return self._flyweights[key]
